package com.insigma.business.qrcode.welfare.service.impl;

import com.insigma.business.qrcode.common.service.SequenceGenerator;
import com.insigma.business.qrcode.soldier.dto.SequenceNameConstant;
import com.insigma.business.qrcode.soldier.entity.MerchantUserDO;
import com.insigma.business.qrcode.welfare.dao.MerchantUserDao;
import com.insigma.business.qrcode.welfare.service.MerchantUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("merchantUserService")
public class MerchantUserServiceImpl implements MerchantUserService {
    @Autowired(required = false)
    private MerchantUserDao merchantUserDao;

    @Autowired(required = false)
    private SequenceGenerator sequenceGenerator;

    @Override
    public MerchantUserDO getByMobile(String mobile) {
        return merchantUserDao.getByMobile(mobile);

    }

    @Override
    public Integer insert(MerchantUserDO merchantUserDO) {
        merchantUserDO.setId(sequenceGenerator.genKey(SequenceNameConstant.MERCHANT_USER_ID));
        return merchantUserDao.insert(merchantUserDO);
    }
}
